package com.yanqu.road.entity.activity.biaoju;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.date.DateHelper;

@FieldTypeAnnotation(tableName = "t_c_biaoju_union", desc = "镖局商会数据")
public class CrossBiaoJuUnionData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(update = true, isIndex = true, desc = "商会id")
    private String unionId;
    @FieldTypeAnnotation(select = true, update = true, isIndex = true, desc = "商会分组")
    private int unionGroup;
    @FieldTypeAnnotation(desc = "镖局等级")
    private int level;
    @FieldTypeAnnotation(desc = "经验")
    private long exp;
    @FieldTypeAnnotation(desc = "经验变更时间")
    private long expChangeTime;
    @FieldTypeAnnotation(desc = "排名")
    private int rank;

    public CrossBiaoJuUnionData() {
    }

    public CrossBiaoJuUnionData(int activityId, String unionId, int unionGroup) {
        this.activityId = activityId;
        this.unionId = unionId;
        this.unionGroup = unionGroup;
        this.level = 1;
        this.expChangeTime = DateHelper.getCurrentTime();
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public int getUnionGroup() {
        return unionGroup;
    }

    public void setUnionGroup(int unionGroup) {
        this.unionGroup = unionGroup;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
        setUpdateOption();
    }

    public long getExp() {
        return exp;
    }

    public void setExp(long exp) {
        this.exp = exp;
        setUpdateOption();
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        if (this.rank != rank) {
            this.rank = rank;
            setUpdateOption();
        }
    }

    public void addExp(long addValue) {
        this.exp += addValue;
        this.expChangeTime = DateHelper.getCurrentTime();
        setUpdateOption();
    }

    public long getExpChangeTime() {
        return expChangeTime;
    }

    public void setExpChangeTime(long expChangeTime) {
        this.expChangeTime = expChangeTime;
        setUpdateOption();
    }
}
